package com.jwsoft.manager.core.gateway.controller;

import com.jwsoft.manager.core.integration.EduSjtj03Integration;
import com.jwsoft.manager.common.vo.eduSjtj03.EduSjtj03VO;
import com.jwsoft.manager.common.vo.eduSjtj03.EduSjtj03KeyVO;
import com.jwsoft.manager.common.vo.eduSjtj03.EduSjtj03QueryVO;
import com.github.pagehelper.PageInfo;
import com.bifang.engine.assistant.core.domain.AppResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;
import com.bifang.engine.protect.core.annotation.Idempotent;
import org.springframework.validation.annotation.Validated;
import com.bifang.assistant.common.constants.Validators;

/**
 * 数据统计03网关
 *
 * @author zhiyuan
 * @since 2023-12-05
 */
@RestController
@RequestMapping(value = "/doc/api")
@Tag(name = "数据统计03", description = "数据统计03")
public class EduSjtj03Controller {

    @Autowired
    public EduSjtj03Integration eduSjtj03Integration;

    @Operation(summary = "数据统计03分页查询",description = "数据统计03分页查询")
    @PostMapping(value = "/eduSjtj030001", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<EduSjtj03VO>> getList(@RequestBody @Validated EduSjtj03QueryVO vo) {
        return AppResponse.successData(eduSjtj03Integration.getList(vo));
    }

    @Operation(summary = "数据统计03根据主键查询详情",description = "数据统计03根据主键查询详情")
    @PostMapping(value = "/eduSjtj030002", produces = "application/json;charset=UTF-8")
    public AppResponse<EduSjtj03VO> getById(@RequestBody @Validated EduSjtj03KeyVO vo) {
        return AppResponse.successData(eduSjtj03Integration.getById(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "数据统计03新增",description = "数据统计03新增")
    @PostMapping(value = "/eduSjtj030004", produces = "application/json;charset=UTF-8")
    public AppResponse<EduSjtj03VO> add(@RequestBody @Validated(value = {Validators.Add.class}) EduSjtj03VO vo) {
        return AppResponse.successData(eduSjtj03Integration.add(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "数据统计03修改",description = "数据统计03修改")
    @PostMapping(value = "/eduSjtj030005", produces = "application/json;charset=UTF-8")
    public AppResponse<EduSjtj03VO> edit(@RequestBody @Validated(value = {Validators.Edit.class}) EduSjtj03VO vo) {
        return AppResponse.successData(eduSjtj03Integration.edit(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "数据统计03删除",description = "数据统计03删除")
    @PostMapping(value = "/eduSjtj030006", produces = "application/json;charset=UTF-8")
    public AppResponse del(@RequestBody @Validated EduSjtj03KeyVO vo) {
        eduSjtj03Integration.del(vo);
        return AppResponse.successMsg("删除成功！");
    }
}
